home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-04-12 | 3.5 KB | 118 lines | [TEXT/MPS ] |
- { T E x t e n d e d T e x t C L A S S }
-
- { This unit creates a class of TExtendedText that will take the input }
- { of real numbers within a range of MaxLong to MinLong, filtering the }
- { keyboard input for any non-valid keys. This view can be read from a }
- { "r" file. See below for the additions you need to add to the view.r }
- { file for the format. The easiest way to create this view is to }
- { create a TNumberText in ViewEdit, deRez it, and make the changes to }
- { agree with the resource format of TExtendedText. I would suggest }
- { overriding the IRES method and adding a field to your instance of }
- { TExtendedText to reference the document so you can store data in the }
- { document's fields. Also, if you wish to have instantaneous feedback }
- { on changed data, override the StopEdit method and get the data at that}
- { point with GetValue. }
-
- {***********************************************************************}
- {* REMINDER: REMEMBER TO SET UP THE DEPEDENCIES IN YOUR MAKE FILE TO *}
- {* ACCOUNT FOR THE USE OF THIS UNIT! *}
- {***********************************************************************}
-
-
-
- UNIT UExtendedText;
-
- INTERFACE
-
- USES
- { • MacApp - this includes all of the things necessary from the MacApp Library }
- UMacApp,
-
- { • Building Blocks }
- UDialog, UPrinting,
-
- { • Implementation Use }
- SANE, ToolUtils, Fonts, Resources, Script, PickerIntf, Packages;
-
-
- CONST
-
- MaxPrec = 8; { Maximum allowable decimal precision }
- { Change this if you need a larger }
- { precision value. }
-
- bReal = - 100; { Constants used in the global }
- bSingle = - 101; { MyFieldToString procedure so }
- bDouble = - 102; { that these types can be }
- bExtended = - 103; { displayed by the inspector. }
-
- TYPE
-
- ExtendedTextTemplatePtr = ^ExtendedTextTemplate;
- ExtendedTextTemplate = RECORD
- minimum: LongInt;
- maximum: LongInt;
- prec: Integer;
- value: str255;
- END;
-
- TExtendedText = OBJECT (TEditText)
-
- fMinimum: Extended;
- fMaximum: Extended;
- fPrecision: integer;
- fValue: str255;
-
-
-
- {$IFC qProceduralViews}
- PROCEDURE TExtendedText.IExtendedText(itsSuperView: TView;
- itsLocation, itsSize: VPoint;
- itsMinimum, itsMaximum : Extended;
- itsPrecision: integer;
- itsValue : str255);
- {$ENDC}
-
- {$IFC qTemplateViews}
- PROCEDURE TExtendedText.IRes (itsDocument: TDocument;
- itsSuperView: TView;
- VAR itsParams: Ptr); OVERRIDE;
- {$ENDC}
-
- {$IFC qWriteTemplates}
- PROCEDURE TExtendedText.WRes (theResource: ViewRsrcHndl; VAR itsParams: Ptr); OVERRIDE;
-
- PROCEDURE TExtendedText.WriteRes (theResource: ViewRsrcHndl;
- VAR itsParams: Ptr); OVERRIDE;
- {$ENDC}
-
- FUNCTION TExtendedText.NotNull: Boolean;
-
- FUNCTION TExtendedText.GetValue: extended;
-
- PROCEDURE TExtendedText.SetValue (newValue: extended; redraw: BOOLEAN);
-
- FUNCTION TExtendedText.Validate: LONGINT; OVERRIDE;
-
- Function TExtendedText.DoKeyCommand ( ch : char; aKeyCode: integer;
- VAR info : eventInfo):TCommand;OVERRIDE;
-
- {$IFC qDebug}
- PROCEDURE TExtendedText.Fields (PROCEDURE DoToField (fieldName: Str255;
- fieldAddr: Ptr; fieldType: INTEGER));OVERRIDE;
- PROCEDURE TExtendedText.Warning( ErrorNum : integer);
- PROCEDURE TExtendedText.PrecWarning;
-
- {$ENDC}
- END; {TExtendedText}
-
- IMPLEMENTATION
-
- {$I UExtendedText.inc1.p}
-
-
-
-
-
-
-